<!--// 2023-08-22-->
<!-- cas zhangjl add  -->
<template>
  <!-- 该页面为从cas验证登后跳转的页面，作用是将后端的 token塞进前端，然后跳转到目的页面或者/index页面 -->
  <div class="casLogin" v-loading="loading">
    <!--    <span class="msg"></span>-->
  </div>
</template>

<script>
  import {setToken} from "@/utils/auth";
  export default {
    name: "casLogin",
    data() {
      return {
        loading: false
      };
    },
    async created() {
      this.loading = true;
      if (
        this.$router &&
        this.$router.history &&
        this.$router.history.current &&
        this.$router.history.current.query &&
        this.$router.history.current.query.token
      ){
        setToken(this.$router.history.current.query.token);
        if(this.$router.history.current.query.target_url){
          this.$router.push(this.$router.history.current.query.target_url).catch(() => {})
        }else{
          this.$router.push('/index').catch(() => {})
        }
      }else {
        this.$modal.msgSuccess("跳转失败");
        this.loading = false;
      }
    },
    methods: {}
  }
</script>

<style rel="stylesheet/scss" lang="scss">
  .casLogin {
    height: 100%;
    width: 100%;
    margin: auto;
    background-color: #bac3c3;
    text-align: center;
    padding-top: 20%;
  }

  .msg {
    font-size: 25px;
  }
</style>
